import request from '@/utils/request'
interface extraType {
  crmUserGroupId: string
  crmUserGroupName: string
  itemFrom: number
  materialContentFrom: number
  materialId: string
  materialName: string
  materialType: string
  rcmdSort: boolean
  resourcesId: number
  taskId: string
  taskType: number
}
export interface categoryListItem {
  bannerList?: null
  bannerUrl: string
  categoryType?: number
  extra: extraType
  frontDesc?: null
  frontName: string
  frontNameIcon?: null
  iconUrl?: null
  id: number
  imgUrl?: null
  level?: null
  name: string
  showIndex: number
  subCateList?: []
  superCategoryId: number
  type: number
  wapBannerUrl: string
  wapExpandPicTargetUrl?: null
}
interface categoryGroupItem {
  categoryList: categoryListItem[]
  id: number
  name: string
}
interface currentListItem {
  extra: extraType
  id: number
  picUrl: string
  targetUrl: string
}
export interface categoryL1ListType {
  categoryGroupList: categoryGroupItem[]
  categoryL1List: categoryListItem[]
  categoryL2List: categoryListItem[]
  currentCategory: {
    bannerList: currentListItem[]
    bannerUrl?: null
    categoryType: number | string
    extra?: null
    frontDesc?: null
    frontName?: null
    frontNameIcon?: null
    iconUrl?: null
    id: number | string
    imgUrl?: null
    level?: null
    name: string
    showIndex?: number
    subCateList: []
    superCategoryId: number | string
    type: number | string
    wapBannerUrl?: null
    wapExpandPicTargetUrl?: null
  }
}
export default {
  getGoodsInfo(id: number) {
    return request.get<any, categoryL1ListType>(
      `/item/cateList.json?__timestamp=1630131286110&categoryId=${id}`
    )
  },
  getGoodsList(categoryId: number) {
    return request.get<any, categoryL2ListType>(
      `/item/list.json?__timestamp=1630133942864&categoryType=0&subCategoryId=0&categoryId=${categoryId}`
    )
  }
}
// ttps://m.you.163.com/item/list.json?__timestamp=1630133942864&categoryType=0&subCategoryId=1008009&categoryId=1005000
interface categoryL2ListType {
  categoryL2List: categoryListItem[]
}
